<template>
    <div>
        <Submenu :name="`${parentName}`" v-if="children && children.length">
            <template slot="title">
                <span>{{ showTitle(parentItem) }}</span>
            </template>
            <template v-for="item in children">
                <side-menu-item v-if="showChildren(item)" :key="`menu-${item.name}`" :parent-item="item"></side-menu-item>
                <menu-item v-else :name="getNameOrHref(item, item.children && item.children.length === 1)" :key="`menu-${item.name}`">
                    <span>{{ showTitle(item.children && item.children.length === 1 ? item.children[0] : item)}}</span>
                </menu-item>
            </template>
        </Submenu>
        <menu-item v-else :name="`${parentName}`">
            <span>{{ showTitle(parentItem) }}</span>
        </menu-item>
    </div>
</template>
<script>
import mixin from './mixin'
import itemMixin from './item-mixin'
export default {
    name: 'SideMenuItem',
    mixins: [ mixin, itemMixin ]
}
</script>
